'''
Author: your name
Date: 2020-10-29 16:52:48
LastEditTime: 2020-10-29 17:12:27
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: \python-study\博客学习\深入\对象属性.py
'''
class Bird(object):
    feather = True

class Chicken(Bird):
    fly = False
    def __init__(self, age):
        self.age = age

class num(object):
    def __init__(self, value):
        self.value = value
    def getNum(self):
        return -self.value
    def setNum(self, value):
        self.value = -value
    def delNum(self):
        print("value also deleted")
        del self.value
    # 在property中，提供四个参数，前三个参数伟函数，第四个参数伟说明，第一个参数标识查询特性，第二个参数标识修改特性，第三个参数标识删除特性，最有一个参数表示该属性得说明
    num = property(getNum, setNum, delNum, "I'm negative")

if __name__=="__main__":
    x = num(1.1)
    print(x.num)
    x.num = -22
    print(x.value)
    print(num.num.__doc__)
    del x.num
    print(x.num)
    # summer=Bird();
    # print(summer.__dict__)
    # chicken=Chicken(2)
    # print(chicken.__dict__)
    # print(Bird.__dict__)
    # print(Chicken.__dict__)